<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./jquery-3.4.1.js"></script>
</head>

<body>
    <h2>大家好，我是S2服务器的index.html</h2>
    <button type="button" onclick="get()">我要访问S1服务器的get接口了</button>
    <button type="button" onclick="mm()">我要窃取S1服务器的小秘密了</button>
</body>
<script>
    function get() {
        $.ajax({
            type: "get",
            url: "http://localhost:3001/get",
            success: function (res) {
                console.log(res);
            },
            error: function (xhr, errortype) {
                console.log(xhr.status);
            }
        })
    }
    function mm() {
        $.ajax({
            type: "get",
            url: "http://localhost:3001/mm",
            success: function (res) {
                console.log(res);
            },
            error: function (xhr, errortype) {
                console.log(xhr.status);
            }
        })
    }
</script>

</html>